package edu.cuit.avatar;

import java.util.Random;

/**
 * @author <a href="mailto:1020zhaodan@163.com">Adan</a>
 * @version 1.0
 * @date 2025/7/4 14:09
 */
public class RandomDemo {
    public static void main(String[] args) {
        Random random = new Random();
        System.out.println(random.nextInt()); //随机的整数
        System.out.println(random.nextInt(1000));//0 - 1000之间随机整数
        System.out.println(random.nextLong());
        System.out.println(random.nextLong(10000));
        System.out.println(random.nextBoolean());
        System.out.println(random.nextBoolean());
        System.out.println(random.nextFloat());
        System.out.println(random.nextDouble());

        System.out.println("======================================");
        Random random1 = new Random(1000);
        Random random2 = new Random(1000);

        for (int i = 0; i < 10; i++)
            System.out.print(random1.nextInt(100) + " ");
        System.out.println();
        for (int i = 0; i < 10; i++)
            System.out.print(random2.nextInt(100) + " ");
    }
}
